package com.certification.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.certification.entity.SchoolInvestigate;
import com.certification.vo.SchoolInvestigateVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author copa
 * @createDate 2022-03-29 23:11
 * @function
 */
@Repository
public interface SchoolInvestigateMapper extends BaseMapper<SchoolInvestigate> {

    @Select("SELECT si.id id, si.investigate_project investigateProject, si.investigate_content investigateContent, si.upload_status uploadStatus " +
            "FROM school_investigate si " +
            "LEFT JOIN certification c ON si.cert_id = c.id " +
            "WHERE c.principal_id = #{userId} ")
    List<SchoolInvestigateVO> selectInvestByUserId(@Param("userId") Integer userId);
}
